package com.lq.learningTest.fanxing;

import com.lq.learningTest.encapsulation.Ticket;

public class TestDemo {
    public static void main(String[] args) {
        //类型Student从Super接口往下传到Link和Array，然后这两个类再传给类下的方法，整个编译阶段都是不知道类型的，之后在这里创建Link和Array实例的时候才明确类型。
        Super<Student> studentSuper = new Link<>();
        studentSuper.add(new Student("zs",12));
        studentSuper.add(new Student("ls",12));
        studentSuper.add(new Student("ww",12));
        for (int i = 1; i <= studentSuper.size(); i++) {
            System.out.println(studentSuper.get(i).getName());
        }

        Super<Student> studentSuper1 = new Array<>();
        studentSuper1.add(new Student("zs",12));
        studentSuper1.add(new Student("ls",12));
        studentSuper1.add(new Student("ww",12));
        for (int i = 0; i < studentSuper1.size(); i++) {
            System.out.println(studentSuper1.get(i).getName());
        }
    }
}
